<? 
	session_start();
	require("Admin/connect.php");
	$mal=$_REQUEST["lopid"];		
	$tiethoc=$_POST["tiethoc"];
	$mamh=$_POST["mamh"];
	$ppct=$_POST["ppct"];
	$baihoc=$_POST["baihoc"];
	$nhanxet=$_POST["nhanxet"];	
	$xeploai=$_POST["xeploai"];
	$magv=$_POST["gvid"];
	$ngay=$_REQUEST["demol1"];
	$sqldate = strtotime($ngay);
	$date = date('Y-m-d', $sqldate);
	$sohs=$_REQUEST["hocsinhvang"];
	$j=0;
	while($j<$sohs)							
	{
		$j++;
		$i=$j*10;
		$mahs=$_POST[$j];
		$trangthai=$_POST[$i];		
		$sql2="insert into chuyencan(mahs,ngay,tiet,chuyencan) values('{$mahs}','{$date}','{$tiethoc}','{$trangthai}')";
		mysql_query("$sql2");		
	}
	$sql="insert into sodaubai(mal,ngay,tiethoc,mamh,ppct,hsvang,baihoc,nhanxet,xeploai,magv) values('{$mal}','{$date}','{$tiethoc}','{$mamh}','{$ppct}','{$sohs}','{$baihoc}','{$nhanxet}','{$xeploai}','{$magv}')";	
	mysql_query("$sql") or die("Error!");
	mysql_close();			
	header("Location:sodaubai.php?mal=$mal");
	
?>